package com.oot2d.util;

import com.oot2d.entity.NPC;
import com.oot2d.entity.Player;
import com.oot2d.event.*;
import com.oot2d.states.Game;

public class API {
    public static API instance;

    public API()
    {
        instance = this;
    }

    //Create a texbox to display on the screen
    public void textbox(String s)
    {

    }

    //Change to a new world
    public void changeWorld(int id)
    {
        WorldManager.loadWorld(id);
    }

    //Start a cutscene
    public void startCutscene()
    {

    }

    //End a cutscene
    public void endCutscene()
    {

    }

    public void moveCamera(float x, float y)
    {

    }

    public void move(int i, float x, float y, float v)
    {
        NPC n = WorldManager.currentWorld.getNPCs(0).get(i);
        NPCMoveAction e = new NPCMoveAction(n, x, y, v);
        n.getEvents().addEvent(e);
    }

    public void moveBy(int i, float x, float y, float v)
    {
        NPC n = WorldManager.currentWorld.getNPCs(0).get(i);
        NPCMoveAction e = new NPCMoveAction(n, n.getX() + x, n.getY() + y, v);
        n.getEvents().addEvent(e);
    }

    public void delay(int i, long d)
    {
        NPC n = WorldManager.currentWorld.getNPCs(0).get(i);
        DelayAction e = new DelayAction(d);
        n.getEvents().addEvent(e);
    }

    public void delay(long d)
    {
        Game.getEvents().addEvent(new DelayAction(d));
    }

    public void getPos()
    {
        System.out.println("x: " + Player.instance.getX() + ", y: " + Player.instance.getY());
    }
}
